package com.yc.cloud.portal.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yc.cloud.basic.api.ResponseResult;
import com.yc.cloud.basic.dto.BaseQueryParam;
import com.yc.cloud.entity.Answer;
import com.yc.cloud.openai.dto.NlpChunkResultDto;
import com.yc.cloud.openai.request.OpenAiParam;
import com.yc.cloud.portal.dto.request.AnswerCacheVoiceParam;
import com.yc.cloud.portal.dto.request.AnswerQueryParam;
import com.yc.cloud.portal.vo.AnswerVo;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import reactor.core.publisher.Flux;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 答题库 服务类
 * </p>
 *
 * @author Yancy
 * @since 2024-01-31
 */
public interface AnswerService extends IService<Answer> {

    /***
     * description:查询列表
     * @param param 查询条件
     * @return 数据信息
     */
    IPage<Answer> list(BaseQueryParam param);

    AnswerVo convertVo(Answer answer);

    List<AnswerVo> convertVo(List<Answer> answerList);

    Answer create(Answer param);

    Answer get(Long id);

    Answer update(Long id, Answer answer);

    boolean delete(Long id);

    Map<Integer, List<AnswerVo>> query(AnswerQueryParam param);

    List<Answer> listByQuestionNo(String questionNo);

//    Map<Integer, List<AnswerVo>> analysis(MultipartFile file, OpenAiParam param);

    Map<Integer, List<AnswerVo>> analysis(byte[] data, OpenAiParam param);

    Flux<String> streamAnalysis(byte[] bytes, OpenAiParam param);

    Flux<ServerSentEvent<String>> streamAnalysis2(byte[] bytes, OpenAiParam param);

    SseEmitter streamAnalysis3(byte[] bytes, OpenAiParam param);

    String importQuestionAndAnswer(MultipartFile file);

    boolean cacheVoiceContent(AnswerCacheVoiceParam param);
}



